package com.sangeng.controller;

import com.sangeng.annotation.SystemLog;
import com.sangeng.domain.ResponseResult;
import com.sangeng.domain.dto.UserDto;
import com.sangeng.domain.entity.User;
import com.sangeng.service.UserService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;

/**
 * 用户表(User)表控制层
 *
 * @author makejava
 * @since 2024-08-17 11:49:51
 */
@RestController
@RequestMapping("user")
@Api(tags = "用户相关接口", description = "用户相关接口")
public class UserController {
    /**
     * 服务对象
     */
    @Resource
    private UserService userService;

    //个人信息查询
    @SystemLog(businessName = "个人信息查询接口")
    @RequestMapping("/userInfo")
    @ApiOperation(value = "个人信息查询接口")
    public ResponseResult userInfo(){
        return userService.getUserInfo();
    }

    //更新个人信息接口
    @SystemLog(businessName = "更新个人信息接口")
    @PutMapping("/userInfo")
    @ApiOperation(value = "更新个人信息接口")
    public  ResponseResult putUserInfo(@RequestBody User user){
       return userService.putUserInfo(user);
    }

    //用户注册
    @SystemLog(businessName = "用户注册接口")
    @PostMapping("/register")
    @ApiOperation(value = "用户注册接口")
    public ResponseResult register(@RequestBody UserDto userDto){
        return userService.register(userDto);
    }

}

